import math
from typing import SupportsAbs


def cross_product(a: tuple[float, float], b: tuple[float, float]) -> float:
    return a[0] * b[1] - a[1] * b[0]


def dot_product(a: tuple[float, float], b: tuple[float, float]) -> float:
    return a[0] * b[0] + a[1] * b[1]


def distance(a: tuple[float, float], b: tuple[float, float]) -> float:
    return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5


class Vector(SupportsAbs):
    def __init__(self, x: float = None, y: float = None, line: 'Line' = None):
        self.x = line.x2 - line.x1 if line else x
        self.y = line.y2 - line.y1 if line else y
        self.length = None

    def __neg__(self):
        return Vector(-self.x, -self.y)

    def __mul__(self, scalar: float):
        return Vector(self.x * scalar, self.y * scalar)

    def __abs__(self) -> float:
        if self.length is None:
            self.length = math.sqrt(self.x ** 2 + self.y ** 2)
        return self.length

    def __add__(self, other: 'Vector') -> 'Vector':
        return Vector(self.x + other.x, self.y + other.y)

    def __truediv__(self, scalar: float) -> 'Vector':
        return Vector(self.x / scalar, self.y / scalar)

    def dot_product(self, other: 'Vector') -> float:
        return self.x * other.x + self.y * other.y

    def cross_product(self, other: 'Vector') -> float:
        return self.x * other.y - self.y * other.x

    def rotate_right_90(self) -> 'Vector':
        return Vector(-self.y, self.x)

    def rotate_left_90(self) -> 'Vector':
        return Vector(self.y, -self.x)

    def __repr__(self):
        return f'Vector({self.x:0.2f}, {self.y:0.2f}, {self.length})'

